package com.example.day_blog.service;

import com.example.day_blog.mapper.BlogInfoMapper;
import com.example.day_blog.model.BlogInfo;
import com.example.day_blog.model.Comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author starsea
 * @date 2024-01-18 16:28
 */
@Service
@Transactional
public class BlogService {
    @Autowired
    private BlogInfoMapper blogInfoMapper;
    public List<BlogInfo> getBlogList()
    {
        return  blogInfoMapper.queryBlogList();
    }
    public BlogInfo getBlogDetail(Integer id)
    {
        return blogInfoMapper.queryById(id);
    }
    public BlogInfo queryByBlogId(Integer blogId)
    {
        return blogInfoMapper.queryByBlogId(blogId);
    }
    public Integer insertBlog(BlogInfo blogInfo)
    {
        return blogInfoMapper.insertBlog(blogInfo);
    }
    public Integer updateBlog(BlogInfo blogInfo)
    {
        return blogInfoMapper.updateBlog(blogInfo);
    }
    public Integer deleteBlog(Integer id)
    {
        return blogInfoMapper.deleteBlog(id);
    }
    //查找点赞数
    public Integer upvote(Integer id)
    {
        return blogInfoMapper.upvote(id);
    }
    //修改点赞数
    public Integer upvoteBlog(Integer updvote,Integer id)
    {
        return blogInfoMapper.upvoteBlog(updvote,id);
    }
}
